extends "../kaixuan-2/kaixuan-2.gd"


func _extInit():
	._extInit()
	lv = 3             #等级的设置
	
	addSkill("每{cd}秒发动剑刃风暴，免疫技能伤害并对周围(九宫格范围)的所有敌人造成每秒[雷击*1]的技能伤害，持续3秒", "剑刃风暴", "jrfb", 10)

func _castCdSkill(id):
	._castCdSkill(id)
	if id=="jrfb":
		jrfb()

func jrfb():
	addBuff(b_jrfb.new(3))

class b_jrfb:
	extends "../../../../azurlane_ctrl/AzurBuff.gd"
	var num
	var p1 = 1
	func _init(lv = 1):
		attInit()
		self.num = num
		life = lv
		id = "b_jrfb"
		buffName = "剑刃风暴"
		dispel = 2
	var eff2
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
		eff2 = sys.newEff("animEff", masCha.position)
		eff2.setImgs(sys.getBasePath() + "/eff/jianRenFengBao", 6, true)
		eff2.scale *= 3
		eff2.normalSpr.position=Vector2(0, -10)
		if masCha.upgraded == 1:
			p1 = 1.3
	func _process(delta):
		if masCha != null && is_instance_valid(eff2):
			eff2.position = masCha.position
	func _del():
		._del()
		if is_instance_valid(eff2):
			eff2.queue_free()
	func _upS():
		if masCha.upgraded == 2:
			for cha in masCha.getCellChas(masCha.cell, 2, 1):
				masCha.azurHurtChara(cha, masCha.att.mgiAtk * 1, sys.HurtType.WEAPON, sys.AtkType.SKILL, "剑刃风暴", true, p1)
		else:
			for cha in masCha.getAroundChas(masCha.cell, false):
				masCha.azurHurtChara(cha, masCha.att.mgiAtk * 1, sys.HurtType.WEAPON, sys.AtkType.SKILL, "剑刃风暴", true, p1)
	func _onHurt(atkInfo:AtkInfo):
		if atkInfo.atkType == sys.AtkType.SKILL:
			atkInfo.virtual = true